//
//  MineHeaderBottomTitleCountView.m
//  FD
//
//  Created by Yasin on 2018/10/16.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//  标题和数量自定义view
/**
 我的v积分   我的卡券
  4258         12
 */
#import "MineHeaderBottomTitleCountView.h"
//宽高100
@implementation MineHeaderBottomTitleCountView

- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title count:(NSString *)cnt
{
    if (self = [super initWithFrame:frame]) {
        [self setupViewWithTitle:title count:cnt];
    }
    return self;
}

- (void)setupViewWithTitle:(NSString *)title count:(NSString *)cnt {
    [self addSubview:self.titleLb];
    [self addSubview:self.cntLb];
    self.titleLb.text = title;
    self.cntLb.text = cnt;
}

//高度默认是 100 . 标题和数量两个控件平分
- (void)layoutSubviews {
    [super layoutSubviews];
    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self);
        make.top.equalTo(self.mas_top).offset(10);
        make.height.mas_equalTo(30);
    }];
    
    [self.cntLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLb.mas_bottom).offset(5);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(30);
    }];
}


//getter
- (UILabel *)titleLb {
    if (!_titleLb) {
        _titleLb = [UILabel new];
        _titleLb.textColor = [UIColor lightGrayColor];
//        _titleLb.backgroundColor = [UIColor redColor];
        _titleLb.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLb;
}
- (UILabel *)cntLb {
    if (!_cntLb) {
        _cntLb = [UILabel new];
//        _cntLb.backgroundColor = [UIColor yellowColor];
        _cntLb.textAlignment = NSTextAlignmentCenter;
        _cntLb.font = [UIFont systemFontOfSize:20.0];
    }
    return _cntLb;
}



@end
